package com.kaishengit.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.kaishengit.entity.Employee;
import com.kaishengit.service.IdeaService;

public class IdeaComment extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String ideaid = request.getParameter("ideaid");
		String content = request.getParameter("content");
		if(content!=""){
		HttpSession  session = request.getSession();
		Employee employee = (Employee) session.getAttribute("employee");
		String eid = employee.getId();
		new IdeaService().saveIdeaComment(content,ideaid,eid);
		}
		response.sendRedirect("showidea.jspx?id="+ideaid);
		
	}

}
